﻿using CPPEI.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CMS.WebApi.article
{
    [AuthPostAction("article", "enable", "1.0")]
    public class EnableAction : BaseAction<EnableParams, EnableResult>
    {
        protected override ActionResult<EnableResult> OnExecute(ActionContext context, SysParams sysParams, EnableParams opParams)
        {
            CMS.Domain.Services.EnableService service = new Domain.Services.EnableService();
            CPPEI.ServiceResult serResult = service.EnableArticle(opParams.Id);

            if(serResult.IsSuccess)
            {
                EnableResult actResult = new EnableResult();
                return new ActionResult<EnableResult>(actResult);
            }
            else
            {
                return new ActionResult<EnableResult>(serResult);
            }
        }
    }

    public class EnableParams
    {
        public Guid Id { get; set; }
    }

    public class EnableResult
    {
    }
}
